<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>查询维修记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
		<span class="layui-breadcrumb"> <a href="index2.html">首页</a> <a href="">维保人员</a>
			<a> <cite>报修记录</cite></a>
		</span> <a class="layui-btn layui-btn-small"
                   style="line-height: 1.6em; margin-top: 3px; float: right"
                   onclick="location.reload()" title="刷新"> <i
        class="layui-icon layui-icon-refresh" style="line-height: 30px"></i>
</a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">

                </div>
                <div class="layui-card-body">
                    <table id="baoxiudanList" lay-filter="baoxiudanList"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/html" id="toolbarList">
</script>
<script>
    layui.use(['form', 'layer', 'laydate', 'table', 'laytpl'], function () {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table;
        var equipment = window.location.search;
        var equipment_id = equipment.substring(1);


        var tableIns = table.render({
            elem: '#baoxiudanList',
            url: 'baoXiuDanLimit',
            cellMinWidth: 95,
            page: true,
            where: {"id": equipment_id},
            height: "full-125",
            limit: 10,
            limits: [10, 15, 20, 25],
            id: "baoxiudanListTable",
            toolbar: "#toolbarList",
            cols: [[
                {type: "checkbox", fixed: "left", width: 50},
                {field: 'equipmentId', title: '设备编号', align: 'center'},
                {field: 'guZhang', title: '故障原因', align: 'center'},
                {field: 'baoXiuManId', title: '维护人员编号', align: 'center'},
                {
                    field: 'status', title: '订单状态', align: 'center', templet: function (data) {
                        if (data.status == "1")
                            return "已处理";
                        else if (data.status == "0")
                            return "未处理";
                    }
                },
                {field: 'repairManId', title: '处理人编号', align: 'center'},
                {field: 'repairRes', title: '处理结果', align: 'center', minWidth: 110},
                {field: 'fee', title: '维修金额', align: 'center', minWidth: 110},
                {
                    title: '操作', fixed: "right", align: "left", templet: function (data) {
                        var str = " <a class='layui-btn    ' lay-event='comment'>添加反馈</a>";
                        var str1 = '<a class="layui-btn  layui-btn-disabled "  id="look">已反馈</a>'
                        if (data.status == 1)
                            return str1;
                        else {
                            return str;
                        }
                    }
                }
            ]]
        });
        table.reload("baoxiudanListTable", {
            page : {
                curr : 1
                //重新从第 1 页开始
            },
            where : {
                name : $("input[name=name]").val(), //搜索的关键字
                category : $("input[name=category]").val()
            }
        });

        //监听表格反馈按钮
        table.on("tool(baoxiudanList)", function (obj) {
            switch (obj.event) {
                case "comment":
                    console.log(obj.data);
                    xadmin.open('评论', "./comment-add.html?" + obj.data.id, 600, 400);
                    break;
            }
        })
    });
</script>

</html>